package com.property.demo.dto;

import com.property.demo.model.Building;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class BuildingDTO {
    private Long id;
    private String name;
    private Long communityId;
    private String communityName;
    private Integer totalFloors;
    private Integer totalUnits;
    private String description;
    private Date createdAt;
    private Date updatedAt;
    
    public BuildingDTO(Building building) {
        this.id = building.getId();
        this.name = building.getName();
        if (building.getCommunity() != null) {
            this.communityId = building.getCommunity().getId();
            this.communityName = building.getCommunity().getName();
        }
        this.totalFloors = building.getTotalFloors();
        this.totalUnits = building.getTotalUnits();
        this.description = building.getDescription();
        this.createdAt = building.getCreatedAt();
        this.updatedAt = building.getUpdatedAt();
    }
} 